]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
gdm: Move logo into the panel
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 17 Oct 2012 16:33:47 +0000 (18:33 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 25 Oct 2012 16:31:16 +0000 (18:31 +0200)
GDM has a 'logo' key in its schema to allow distributors to add
some branding. It is currently placed above the user list, which
no longer works too well since the login screen lost its dialog
window. Display the logo in the top-left corner instead of the
Activities button instead.

https://bugzilla.gnome.org/show_bug.cgi?id=685852

js/gdm/loginDialog.js
js/ui/panel.js
js/ui/sessionMode.js

index 15308ddfc5587a0a05bc7a2cb994338b0cafe5e0..42477322ecb443f835b609556eab3412a5f356e3 100644 (file)
@@ -39,13 +39,14 @@ const GdmUtil = imports.gdm.util;
 const Lightbox = imports.ui.lightbox;
 const Main = imports.ui.main;
 const ModalDialog = imports.ui.modalDialog;
+const PanelMenu = imports.ui.panelMenu;
 const Tweener = imports.ui.tweener;
 const UserMenu = imports.ui.userMenu;
 
 const _RESIZE_ANIMATION_TIME = 0.25;
 const _SCROLL_ANIMATION_TIME = 0.5;
 const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0;
-const _LOGO_ICON_NAME_SIZE = 48;
+const _LOGO_ICON_HEIGHT = 16;
 
 let _loginDialog = null;
 
@@ -82,6 +83,36 @@ function _smoothlyResizeActor(actor, width, height) {
     return hold;
 }
 
+const LogoMenuButton = new Lang.Class({
+    Name: 'LogoMenuButton',
+    Extends: PanelMenu.Button,
+
+    _init: function() {
+        this.parent(0.0, null, true);
+
+        this._settings = new Gio.Settings({ schema: GdmUtil.LOGIN_SCREEN_SCHEMA });
+        this._settings.connect('changed::' + GdmUtil.LOGO_KEY,
+                               Lang.bind(this, this._updateLogo));
+
+        this._iconBin = new St.Bin();
+        this.actor.add_actor(this._iconBin);
+
+        this._updateLogo();
+    },
+
+    _updateLogo: function() {
+        let path = this._settings.get_string(GdmUtil.LOGO_KEY);
+        let icon = null;
+
+        if (path) {
+            let file = Gio.file_new_for_path(path);
+            let cache = St.TextureCache.get_default();
+            icon = cache.load_uri_async(file.get_uri(), -1, _LOGO_ICON_HEIGHT);
+        }
+        this._iconBin.set_child(icon);
+    }
+});
+
 const UserListItem = new Lang.Class({
     Name: 'UserListItem',
 
@@ -659,17 +690,11 @@ const LoginDialog = new Lang.Class({
 
         this._settings = new Gio.Settings({ schema: GdmUtil.LOGIN_SCREEN_SCHEMA });
 
-        this._settings.connect('changed::' + GdmUtil.LOGO_KEY,
-                               Lang.bind(this, this._updateLogo));
         this._settings.connect('changed::' + GdmUtil.BANNER_MESSAGE_KEY,
                                Lang.bind(this, this._updateBanner));
         this._settings.connect('changed::' + GdmUtil.BANNER_MESSAGE_TEXT_KEY,
                                Lang.bind(this, this._updateBanner));
 
-        this._logoBox = new St.Bin({ style_class: 'login-dialog-logo-box' });
-        this.contentLayout.add(this._logoBox);
-        this._updateLogo();
-
         this._bannerLabel = new St.Label({ style_class: 'login-dialog-banner',
                                            text: '' });
         this.contentLayout.add(this._bannerLabel);
@@ -770,20 +795,6 @@ const LoginDialog = new Lang.Class({
 
    },
 
-    _updateLogo: function() {
-        this._logoBox.child = null;
-        let path = this._settings.get_string(GdmUtil.LOGO_KEY);
-
-        if (path) {
-            let file = Gio.file_new_for_path(path);
-            let uri = file.get_uri();
-
-            let textureCache = St.TextureCache.get_default();
-            this._logoBox.child = textureCache.load_uri_async(uri, -1, _LOGO_ICON_NAME_SIZE);
-        }
-
-    },
-
     _updateBanner: function() {
         let enabled = this._settings.get_boolean(GdmUtil.BANNER_MESSAGE_KEY);
         let text = this._settings.get_string(GdmUtil.BANNER_MESSAGE_TEXT_KEY);
@@ -802,8 +813,7 @@ const LoginDialog = new Lang.Class({
         let tasks = [this._hidePrompt,
 
                      new Batch.ConcurrentBatch(this, [this._fadeInTitleLabel,
-                                                      this._fadeInNotListedButton,
-                                                      this._fadeInLogo]),
+                                                      this._fadeInNotListedButton]),
 
                      function() {
                          this._sessionList.close();
@@ -1089,8 +1099,7 @@ const LoginDialog = new Lang.Class({
                      },
 
                      new Batch.ConcurrentBatch(this, [this._fadeOutTitleLabel,
-                                                      this._fadeOutNotListedButton,
-                                                      this._fadeOutLogo]),
+                                                      this._fadeOutNotListedButton]),
 
                      function() {
                          let hold = new Batch.Hold();
@@ -1103,14 +1112,6 @@ const LoginDialog = new Lang.Class({
         batch.run();
     },
 
-    _fadeInLogo: function() {
-        return GdmUtil.fadeInActor(this._logoBox);
-    },
-
-    _fadeOutLogo: function() {
-        return GdmUtil.fadeOutActor(this._logoBox);
-    },
-
     _fadeInBanner: function() {
         return GdmUtil.fadeInActor(this._bannerLabel);
     },
@@ -1159,8 +1160,7 @@ const LoginDialog = new Lang.Class({
                      },
 
                      new Batch.ConcurrentBatch(this, [this._fadeOutTitleLabel,
-                                                      this._fadeOutNotListedButton,
-                                                      this._fadeOutLogo]),
+                                                      this._fadeOutNotListedButton]),
 
                      function() {
                          return this._userList.shrinkToNaturalHeight();
index adb23f2d7d84e7ab33252cdaf39f37d177719303..29165f6f179486dbf3c0c438c90ce488842ddabc 100644 (file)
@@ -901,6 +901,7 @@ const PANEL_ITEM_IMPLEMENTATIONS = {
     'volume': imports.ui.status.volume.Indicator,
     'battery': imports.ui.status.power.Indicator,
     'lockScreen': imports.ui.status.lockScreenMenu.Indicator,
+    'logo': imports.gdm.loginDialog.LogoMenuButton,
     'keyboard': imports.ui.status.keyboard.InputSourceIndicator,
     'powerMenu': imports.gdm.powerMenu.PowerMenuButton,
     'userMenu': imports.ui.userMenu.UserMenuButton
index 808109aff0f4c1e5c20b573163efb5d2577e5cf7..feca51ee07107da2b13c58514e8dcb24435fe6ff 100644 (file)
@@ -39,7 +39,7 @@ const _modes = {
         unlockDialog: imports.gdm.loginDialog.LoginDialog,
         components: ['polkitAgent'],
         panel: {
-            left: [],
+            left: ['logo'],
             center: ['dateMenu'],
             right: ['a11y', 'display', 'keyboard',
                     'volume', 'battery', 'powerMenu']